﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CommonExtensions.StringExtensions;

namespace DBMigrator.Core.DbObjects.ForeignKey
{
    public class AddForeignKey : ForeignKey, IAddForeignKey
    {
        public string PrimaryKeyTableName { get; private set; }
        public string PrimaryKeyColumnName { get; private set; }

        public AddForeignKey(string name, string primaryKeyTableName, string primaryKeyColumnName)
            : base(name)
        {
            if(primaryKeyTableName.IsBlank())
                throw new ArgumentNullException("primaryKeyTableName");
            if(primaryKeyColumnName.IsBlank())
                throw new ArgumentNullException("primaryKeyColumnName");

            PrimaryKeyTableName = primaryKeyTableName;
            PrimaryKeyColumnName = primaryKeyColumnName;
        }

        public AddForeignKey(string primaryKeyTableName, string primaryKeyColumnName)
            : this(null, primaryKeyTableName, primaryKeyColumnName)
        {}
    }
}
